
Ext.define('DCApp.view.attach.List', {
    extend: 'Ext.grid.Panel',
    alias: 'widget.attachlist',

    requires: [
        'DCApp.view.attach.ListController',
        'DCApp.view.attach.ListModel',
        'DCApp.view.GridFilters'
    ],

    // Connects to our View Controller (Ticket.view.ticket.SearchController) and View Model
    // (Ticket.view.ticket.SearchModel).
    controller: 'attachlist',
    plugins: ['gfilters'],
    viewModel: {
        type: 'attachlist'
    },
    header:false,
    selType: 'checkboxmodel',
    bind: {
        store: '{objs}'
    },

    tbar: ['->',{
    	xtype:'fileupload',
    	multiple:true,
    	entity_to:'CeAttachment'
  },{
      text: '删除',
      handler: 'onRemove'
  }],

	bubbleEvents:['viewattach'],

	listeners: {
        itemdblclick: 'onDblClick'
    },

    columns: [
            {
                text     : '编号',
                dataIndex: 'id',
                filter: 'number'
            },
            {
                text     : '题名',
                dataIndex: 'name',
                width:260,
                filter: {
                    type: 'string',
                    itemDefaults: {
                        emptyText: 'Search for...'
                    }
                }
            },{
                text     : '文件大小',
                dataIndex: 'filesize',
                filter: 'number'
            },{
                text     : '类型',
                dataIndex: 'suffix',
                filter: {
                    type: 'list',
                    options: [
                      ['jpg', 'jpg'],
                      ['doc', 'doc'],
                      ['xls', 'xls'],
                      ['zip', 'zip']
                  ]
                }
            },{
                text     : '路径',
                dataIndex: 'path',
                width:300,
                renderer:function(v,r,rec, rowIndex, columnIndex, store){
                	return "<a target='_blank' href='/fileopen?fp=" + v + "'>"+v+"</a>";
                }
            }
        ],
    initComponent: function(){
    	 this.callParent();
    }
 });
